<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <title>SSO统一登录平台</title>
    <!-- css import -->
    <link rel="stylesheet" href="${ctx}/js/login/bootstrap.min.css">
    <link rel="stylesheet" href="${ctx}/css/font-awesome.min.css">
    <link rel="stylesheet" href="${ctx}/css/ionicons.min.css">
    <link rel="stylesheet" href="${ctx}/js/login/AdminLTE.min.css">
    <link rel="stylesheet" href="${ctx}/js/login/blue.css">
    <!-- js import -->
    <script src="${ctx}/js/login/jQuery-2.2.0.min.js"></script>
    <script src="${ctx}/js/login/bootstrap.min.js"></script>
    <!-- iCheck -->
    <script src="${ctx}/js/login/icheck.min.js"></script>
    <script type="text/javascript" src="${ctx}/js/jquery-md5-min.js"></script>
    <script type="text/javascript" src="${ctx}/js/login/pptBox.js"></script>
    <style type="text/css">
        .frame {
            height: 49px;
            margin: 0;
            padding: 0;
            border-bottom: 1px solid #ddd;
        }

        .frame a {
            color: #666;
        }

        .frame a:hover {
            color: #222;
        }

        .frame .buttons a {
            height: 49px;
            line-height: 49px;
            display: inline-block;
            text-align: center;
            width: 50px;
            border-left: 1px solid #ddd;
        }

        .frame .brand {
            color: #444;
            font-size: 20px;
            line-height: 49px;
            display: inline-block;
            padding-left: 10px;
        }

        .frame .brand small {
            font-size: 14px;
        }
    </style>
</head>
<script type="text/javascript">
    //解决ie不支持trim
    $(document).ready(
            function () {
                if (!String.prototype.trim) {
                    String.prototype.trim = function () {
                        return this.replace(/^\s+|\s+$/g, '');
                    };
                }
            }
    );
    //回车登录
    document.onkeydown = function mykeyDown(e) {
        //compatible IE and firefox because there is not event in firefox
        e = e || event;
        if (e.keyCode == 13) {
            sumbit();
        }
        return;
    };

    //登录操作
    function sumbit() {
        var uname = $('#userEname2').val();
        var upass = $('#upass').val();
        if (uname == null || uname == "") {
            setErrMsg('请输入用户名');
            $('#userEname2').focus();
            return;
        }
        if (upass == null || upass == "") {
            setErrMsg('请输入密码');
            $('#upass').focus();
            return;
        }
        $("#userEname").val(uname);
        $("#userPass").val(upass.md5());
        //数据提交
        $.ajax({
            url: '${ctx}/passport/login/login.action',
            type: 'post',
            data: $("#inputForm").serialize(),
            success: function (jdata) {
                //alert(data);
                //  var jdata = jQuery.parseJSON(data);
                if (jdata.flag == 'T') {
                    //使用此种方式防止外部系统登录无法跨域访问
                    var url = jdata.msg;
                    window.location.href = url;
                } else {
                    setErrMsg(jdata.msg);
                    clearForm();
                }
            }, error: function (data) {
                setErrMsg('与服务器连接失败');
            }
        });
    }

    //清空表单数据
    function clearForm() {
        $("#upass").val("");
        $("#userEname2").val("");
    }

    function setErrMsg(msg) {
        $("#error-message").html("<font color='red'>" + msg + "</font>");
    }
</script>
<style>
    * {
        padding: 0;
        margin: 0;
    }

    .login_title {
        color: #1169af;
        font-size: 30px;
    }

    .login_title p {
        display: inline-block;
        padding-right: 10px;
        border-right: 0px solid #1169af;
    }

    .login_title span {
        display: inline-block;
        font-size: 14px;
        color: #464849;
        padding-left: 10px;
    }

    .login_wrap {
        background: #1169af;
    }

    .login-box {
        height: 325px;
        background: #fff;
        box-shadow: 0 1px 1px #ddd;
    }

    .login-box h6 {
        text-align: center;
        font-weight: bold;
        font-size: 18px;
        color: #214349;
        padding: 30px 0;
    }

    #inputForm {
        padding: 0 30px;
    }

    #inputForm .form-group:last-child {
        margin-top: 25px;
    }

    .login_btn {
        margin: 30px 15px 0 15px;
        border-top: 1px solid #ddd;
        color: #a5a8aa;
        padding: 20px 15px 0 15px
    }

    .login_btn a {
        color: #a5a8aa
    }

    .login_btn button {
        background: #1169af;
        color: #fff;
        border-radius: 5px;
    }

    .form-control-feedback {
        left: 0;
        top: 7px;
        color: #aaaaaa;
    }

    .has-feedback .form-control {
        color: #aaaaaa;
        height: 45px;
        line-height: 45px;
        padding: 10px 0 10px 30px;
    }

    .form-control:focus {
        border: 1px solid #88a8c1;
        box-shadow: 2px 2px 5px rgba(136, 168, 193, .5);
    }

    .footer {
        color: #969696;
        margin: 10px 0;
    }
</style>
<body class="">
<div class="container">
    <h1 class="login_title"><p>SSO统一登录平台</p> <span></span></h1>
</div>
<div class="login_wrap">
    <div class="container">
        <div class="row">
            <div class="col-md-12 col-xs-12 col-lg-12">
                <!-- login start -->
                <!-- /.login-logo -->
                <div class="login-box">
                    <h6>登录信息</h6>
                    <form action="" method="post" id="inputForm">
                        <input type="hidden" name="go" value="${parameter_go!''}"/>
                        <input type="hidden" name="cset" value="${parameter_cset!''}"/>
                        <input type="hidden" name="sys" value="${parameter_sys!''}"/>
                        <input type="hidden" name="_client" value="${parameter_client!''}"/>
                        <input id="userPass" name="userPass" type="hidden"/>
                        <input id="userEname" name="userEname" type="hidden"/>
                    </form>
                    <div class="col-md-12 col-xs-12 col-lg-12">
                        <div class="form-group has-feedback">
                            <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
                            <input id="userEname2" class="form-control" tabindex="1"
                                   placeholder="输入用户名" type="text" value=""/>
                        </div>
                        <div class="form-group has-feedback">
                            <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                            <input type="password" id="upass" class="form-control"
                                   placeholder="输入密码" value="">
                        </div>
                    </div>

                    <div class="login_btn">
                        <div class="row">
                            <!--  <div class="col-xs-8">
                               <a href="${ctx}/passport/reg/passport-mn.action" tabindex="4">忘记密码?</a> |
                               <a href="${ctx}/passport/reg/passport-reg.action" class="text-center">注册</a>
                            </div>
                             -->
                            <div class="col-xs-12">
                                <button type="button" class="btn btn-block" onclick="sumbit()">登 录
                                </button>
                            </div>
                            <div class="col-xs-12" id="error-message"></div>
                        </div>
                    </div>
                    <!-- /.login-box-body -->
                    <!-- login end -->
                </div>
            </div>
        </div>
    </div>

    <footer class="footer" style="color:#fff;">
        <center>Copyright © 2018 - 2022 <br>
            推荐使用浏览器：IE9、360浏览器、火狐、谷歌
        </center>
    </footer>
    <script>
        $(function () {
            $('input').iCheck({
                checkboxClass: 'icheckbox_square-blue',
                radioClass: 'iradio_square-blue',
                increaseArea: '10%' // optional
            });
        });
    </script>
</body>
</html>